package com.zhuoya.healthcard.update;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.zhuoya.healthcard.MainActivity;

public class InstallReceiver extends BroadcastReceiver {
    private static final String PACKAGE_REPLACE_1="android.intent.action.PACKAGE_REPLACED";
    private static final String PACKAGE_REPLACE_2="android.intent.action.MY_PACKAGE_REPLACED";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (PACKAGE_REPLACE_1.equals(intent.getAction())|| PACKAGE_REPLACE_2.equals(intent.getAction())){
            Intent intent2 = new Intent(context, MainActivity.class);
            intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent2);

        }
    }
}
